package rpg.script;

import rpg.map.Effect;
import rpg.map.Location;
import square.script.EffectScript;

public abstract class EffectScriptImpl extends MapObjectScriptImpl implements
		EffectScript {
	private Long startTime;
	private Location location;

	// Use Events
	public boolean onUse(Location location) {
		startTime = System.currentTimeMillis();
		setLocation(location);
		return true;
	}

	// Paint Events
	@Override
	public boolean onPaint(Object context) {
		return true;
	}

	// Shortcut
	public int usePercent() {
		return (int) ((System.currentTimeMillis() - startTime) * 100 / this
				.getEffect().getData().getTime());
	}

	// Get & Set
	public Effect getObject() {
		return (Effect) super.getObject();
	}

	public Effect getEffect() {
		return this.getObject();
	}

	public Long getStartTime() {
		return startTime;
	}

	public void setStartTime(Long startTime) {
		this.startTime = startTime;
	}
	
	public Location getLocation() {
		return location;
	}public void setLocation(Location location) {
		this.location = location;
	}
}
